//
//  MYY_walletNavView.m
//  meiyinxiang
//
//  Created by 陈李飞 on 2017/11/1.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYY_walletNavView.h"


@interface MYY_walletNavView()
@property(nonatomic, strong) UILabel *nameView;


@end

@implementation MYY_walletNavView
-(id)init
{
    self = [super init];
    
    if (self) {
        //左侧按钮
        CGFloat buttomCons = -15;
        if (IS_IPHONE_X) {
            buttomCons = -24;
        }
        _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _cancelBtn.frame = CGRectMake(10, 20, 30, 30);
        [_cancelBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
        [_cancelBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -5, 0, 0)];
        [_cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_cancelBtn addTarget:self action:@selector(cancelPostBtn) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_cancelBtn];
        [_cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@10);
            make.bottom.equalTo(@(buttomCons));
            make.width.equalTo(@30);
            make.height.equalTo(@30);
        }];
        //右侧按钮
        _rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _rightBtn.frame = CGRectMake(WIDTH-90, 20, 70, 30);
        _rightBtn.titleLabel.font = [UIFont systemFontOfSize:16];
        [_rightBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -5)];
        [_rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_rightBtn addTarget:self action:@selector(submmitPostBtn) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_rightBtn];
        [_rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(@(-10));
            make.bottom.equalTo(@(buttomCons));
            make.width.equalTo(@70);
            make.height.equalTo(@30);
        }];
        _nameLable = [[UILabel alloc] initWithFrame:CGRectMake((WIDTH-100)/2, 20, 100, 30)];
        _nameLable.font = MYYFont(18.0f);
        _nameLable.textAlignment = NSTextAlignmentCenter;
        _nameLable.text = @"我的钱包";
        _nameLable.textColor = [UIColor whiteColor];
        [self addSubview:_nameLable];
        [_nameLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.bottom.equalTo(@(buttomCons));
        }];
    }
    return self;
}


#pragma mark - property
-(void)cancelPostBtn{
    self.backButton();
}

-(void)submmitPostBtn{
    self.rightButton();
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
